Feat/wasm opt post build#238
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Confidence Score: 5/5
Safe to merge — the change is entirely additive, the default pipeline is byte-identical when no [build.wasm-opt] table is present, and every failure path leaves the original out/main.wasm untouched.
All new code paths are guarded by explicit opt-in (manifest table presence), failure cases are handled defensively (atomic rename, temp cleanup, re-validation), and the test suite includes hermetic unit tests, a compiled fake-binary fixture, and in-process TCP stub integration tests covering the full install-and-optimize lifecycle. The one noted inconsistency — a fixed rather than process-unique temp file in the optimizer — is a minor concern that does not affect correctness for typical usage.
apps/infs/src/commands/wasm_opt.rs — the optimized_tmp_path helper uses a fixed sibling name (main.wasm.opt) rather than a process-unique one; see inline comment.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[infs build / infs run] --> B{project mode?} B -- no --> Z[single-file: unchanged pipeline] B -- yes --> C[run infc compile] C --> D{infc exit 0?} D -- no --> E[error: build failed] D -- yes --> F{wasm-opt table present and enabled and not --no-wasm-opt?} F -- no --> G[out/main.wasm as-is] F -- yes --> H{proof mode or -v build?} H -- yes --> I[skip silently] H -- no --> J[read out/main.wasm] J --> K{verification opcode in bytes?} K -- yes --> L[hard error: name construct plus remediation] K -- no --> M{resolve wasm-opt: WASM_OPT_PATH then PATH then managed?} M -- found --> N[check version >= 116] M -- not found, auto-install=true --> O[download plus verify SHA-256] M -- not found, auto-install=false --> P[hard error: install hints] O --> N N --> Q[wasm-opt runs, writes main.wasm.opt] Q --> R{exit 0?} R -- no --> S[error: leave original unchanged] R -- yes --> T[re-validate optimized bytes] T --> U{valid?} U -- no --> V[error: leave original unchanged] U -- yes --> W[atomic rename to out/main.wasm, print size summary]%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[infs build / infs run] --> B{project mode?} B -- no --> Z[single-file: unchanged pipeline] B -- yes --> C[run infc compile] C --> D{infc exit 0?} D -- no --> E[error: build failed] D -- yes --> F{wasm-opt table present and enabled and not --no-wasm-opt?} F -- no --> G[out/main.wasm as-is] F -- yes --> H{proof mode or -v build?} H -- yes --> I[skip silently] H -- no --> J[read out/main.wasm] J --> K{verification opcode in bytes?} K -- yes --> L[hard error: name construct plus remediation] K -- no --> M{resolve wasm-opt: WASM_OPT_PATH then PATH then managed?} M -- found --> N[check version >= 116] M -- not found, auto-install=true --> O[download plus verify SHA-256] M -- not found, auto-install=false --> P[hard error: install hints] O --> N N --> Q[wasm-opt runs, writes main.wasm.opt] Q --> R{exit 0?} R -- no --> S[error: leave original unchanged] R -- yes --> T[re-validate optimized bytes] T --> U{valid?} U -- no --> V[error: leave original unchanged] U -- yes --> W[atomic rename to out/main.wasm, print size summary]Reviews (2): Last reviewed commit: "Update component.rs" | Re-trigger Greptile